# filename = 'Chapter 10--文件和异常/practice2/guest.txt'
# username = input('请输入用户名：')
# with open(filename, 'w') as file_object:
#     file_object.write(username)


filename = 'Chapter 10--文件和异常/practice2/guest_book.txt'
while True:
    username = input('请输入用户名：')
    if username != 'quit':
        print('欢迎来到海底捞做客')
        with open(filename, 'a') as file_object:
            file_object.write(f"welcome to the restrant {username}, create new record!\n")
    elif  username == 'quit':
        print('==程序结束==')
        break